package org.stone.project.tx.sysEnum;

import cn.hutool.core.util.ObjectUtil;

/**
 * 响应消息类别
 */
public enum MsgType {
    //连接相关
    LOGIN(1,"登录"),
    LOGOUT(999,"退出登录"),

//    响应消息类别
    TXT(1001,"文本"),
    PIC(1002,"图片"),
    VIDEO(1003,"视频"),
    FILE(1009,"文件"),


    USER_ADD(2001,"好有添加"),
    ;

    public Integer code;

    public String describ;

    MsgType(Integer code, String describ) {
        this.code = code;
        this.describ = describ;
    }

    public static MsgType getInstance(Integer code){
        if (ObjectUtil.isNull(code)){
            return null;
        }
        MsgType[] values = values();
        for (MsgType value : values) {
            if (value.code.equals(code))
                return value;
        }
        return null;
    }
}
